const { createProxyMiddleware } = require('http-proxy-middleware');

const defaultTarget = 'http://';
const JSESSIONID = '';
const defaultConfig = {
  target: defaultTarget,
  changeOrigin: true,
  secure: true,
  onProxyReq(proxyReq) {
    proxyReq.setHeader('Cookie', `JSESSIONID=${JSESSIONID}`);
  },
};
module.exports = (app) => {
  app.use(createProxyMiddleware('/api', { ...defaultConfig }));
};
